<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>易能旅游网站--订单详情</title>
	<%@ include file="/pages/common/common_f.jsp" %>	
	<style type="text/css">
		a:hover{
			text-decoration: none;
		}
	
		.tknr{
			width: 744px;
			height: 200px;
			overflow: auto;
		}
		
		tr{
			height: 28px;
		}
		
		td.titletd{
			width: 80px;
			text-align: right;
		}
		
		input{
			width: 150px;
			height:20px;
			border: 1px solid #92B7D0;
			
		}
	</style>
	<script type="text/javascript">
			$(function(){
				$('#doubleRoom').change(freshPrice);
				$('#singleRoom').change(freshPrice);
				$('#childHaveBed').change(freshPrice);
				$('#childNoBed').change(freshPrice);
				$('#addBed').change(freshPrice);
			});
			
			function freshPrice(){
				var doubleRoom=$('#doubleRoom').val();
				var singleRoom=$('#singleRoom').val();
				var childHaveBed=$('#childHaveBed').val();
				var childNoBed=$('#childNoBed').val();
				var addBed=$('#addBed').val();
				$('#totalNum').val(parseInt(doubleRoom)+parseInt(singleRoom)+parseInt(childHaveBed)+parseInt(childNoBed)+parseInt(addBed));
				var href='${ctx}/book/getPriceTable.usr?';
				href+='doubleRoom='+doubleRoom;
				href+='&singleRoom='+singleRoom;
				href+='&childHaveBed='+childHaveBed;
				href+='&childNoBed='+childNoBed;
				href+='&addBed='+addBed;
				
				$('#tt').panel('refresh',href);
			}
			
			function submitOrder(){
				if(!$('#haveRead').attr("checked")==true){
					$.messager.alert('提示','请先阅读条款内容','info');
					return false;
				}
				var r = $('#orderForm').form('validate');
				if(!r) {
					return false;
				}
				if($('#goTime').val()==""){
					$.messager.alert('提示','请输入启程日期','info');
					return false;
				}
				if($('#backTime').val()==""){
					$.messager.alert('提示','请输入返回日期','info');
					return false;
				}
				var totalNum=$('#totalNum').val();
				if(totalNum=="0"||totalNum=="NaN"){
					$.messager.alert('提示','总人数不能为0','warning');
					return false;
				}
				
				if($('#orderTotalAmount').val()==""){
					$.messager.alert('提示','非法订单，不能提交','error');
					return false;
				}
				
				$('#orderForm').submit();//提交表单
			}
			
		/** 设置资源 */
		function setRes(cityId,resType,title,routeDetailId){
			$("#settingWin").window({
		  		title:title,
		  		href:'${ctx}/res/toResList.usr?resType='+resType+'&cityId='+cityId+"&routeDetailId="+routeDetailId,
		  		width:480,
		  		height:270
  			});
		}	
	</script>	
	
  </head>
  <body style="margin:0;padding:0;height:100%;overflow:scroll;background:#F2FBFF">
  	<div class="main">
		<jsp:include page="/pages/front/inc/header.jsp"></jsp:include><!-- 顶部导航 -->
		<div class="info">
			<span class="location"><span style="font-weight: bold;">位置：</span>首页>用户中心>订单管理</span>
			<span class="user"><jsp:include page="/pages/front/inc/login_info.jsp"/></span>
		</div>
		<div class="content">
			<div class="left">
				<jsp:include page="/country/queryAll.usr"></jsp:include><!-- 左侧国家 -->
			</div>
			<div class="right" id="right">
				<!-- 右侧内容区域 -->
				<div style="margin: 5px;">
					<div class="easyui-panel" style="padding: 5px;" title="线路行程详情" collapsible="false" minimizable="false" maximizable="false" closable="false">
						<div class="routeinfo">
							<table>
								<tr>
									<td class="itemname">线路名称：</td>
									<td>${route.routeName}</td>
								</tr>
								<tr>
									<td class="itemname">线路时长：</td>
									<td>${route.day }天${route.night }夜</td>
								</tr>
								<tr>
									<td  class="itemname" valign="top">线路介绍：</td>
									<td>${route.remark}</td>
								</tr>
							</table>
						</div>
						<div class="easyui-accordion" animate="false">
							<c:forEach items="${details}" var="detail">
							<div title="第${detail.routeDetail.whichDay }天：${detail.routeDetail.depart} - ${detail.routeDetail.arrivel}(目的地：${detail.routeDetail.cityCn})" style="overflow:hidden;padding: 5px;">
								<table class="mytable" cellspacing="0">
									<tr>
										<td width="60px;">住宿：</td>
										<td id="${detail.routeDetail.detailId}-${constant.RES_TYPE_HOTEL}">
										<c:forEach items="${detail.resList}" var="res">
											<c:if test="${res.resType eq constant.RES_TYPE_HOTEL}">
											${res.resource.hotelName}&nbsp;
											</c:if>
										</c:forEach>
										</td>
										<td class="setrec" align="right">[<a href="javascript:void(0);" onclick="setRes('${detail.routeDetail.cityId}',${constant.RES_TYPE_HOTEL},'定制住宿','${detail.routeDetail.detailId}');">定制</a>]</td>
									</tr>
									<tr class="rowalt2">
										<td>活动：</td>
										<td id="${detail.routeDetail.detailId}-${constant.RES_TYPE_ACTIVITY}">
										<c:forEach items="${detail.resList}" var="res">
											<c:if test="${res.resType eq constant.RES_TYPE_ACTIVITY}">
											${res.resource.activityName}&nbsp;
											</c:if>
										</c:forEach>
										</td>
										<td class="setrec" align="right">[<a href="javascript:void(0);" onclick="setRes('${detail.routeDetail.cityId}',${constant.RES_TYPE_ACTIVITY},'添加活动','${detail.routeDetail.detailId}');">添加</a>]</td>
									</tr>
									<tr>
										<td>早餐：</td>
										<td id="${detail.routeDetail.detailId}-${constant.RES_TYPE_ZAOCAN}">
										<c:forEach items="${detail.resList}" var="res">
											<c:if test="${res.resType eq constant.RES_TYPE_ZAOCAN}">
											${res.resource.repastWhat}&nbsp;
											</c:if>
										</c:forEach>
										</td>
										<td class="setrec" align="right">[<a href="javascript:void(0);" onclick="setRes('${detail.routeDetail.cityId}',${constant.RES_TYPE_ZAOCAN},'添加早餐','${detail.routeDetail.detailId}');">添加</a>]</td>
									</tr>
									<tr class="rowalt2">
										<td>午餐：</td>
										<td id="${detail.routeDetail.detailId}-${constant.RES_TYPE_WUCAN}">
										<c:forEach items="${detail.resList}" var="res">
											<c:if test="${res.resType eq constant.RES_TYPE_WUCAN}">
											${res.resource.repastWhat}&nbsp;
											</c:if>
										</c:forEach>
										</td>
										<td class="setrec" align="right">[<a href="javascript:void(0);" onclick="setRes('${detail.routeDetail.cityId}',${constant.RES_TYPE_WUCAN},'添加午餐','${detail.routeDetail.detailId}');">添加</a>]</td>
									</tr>
									<tr>
										<td>晚餐：</td>
										<td id="${detail.routeDetail.detailId}-${constant.RES_TYPE_WANCAN}">
										<c:forEach items="${detail.resList}" var="res">
											<c:if test="${res.resType eq constant.RES_TYPE_WANCAN}">
											${res.resource.repastWhat}&nbsp;
											</c:if>
										</c:forEach>
										</td>
										<td class="setrec" align="right">[<a href="javascript:void(0);" onclick="setRes('${detail.routeDetail.cityId}',${constant.RES_TYPE_WANCAN},'添加晚餐','${detail.routeDetail.detailId}');">添加</a>]</td>
									</tr>
									<tr class="rowalt2">
										<td>接送：</td>
										<td id="${detail.routeDetail.detailId}-${constant.RES_TYPE_CAR}">散拼</td>
										<td class="setrec" align="right">[<a href="javascript:void(0);" onclick="setRes('${detail.routeDetail.cityId}',${constant.RES_TYPE_CAR},'定制接送','${detail.routeDetail.detailId}');">定制</a>]</td>
									</tr>
									<tr>
										<td>导游：</td>
										<td id="${detail.routeDetail.detailId}-${constant.RES_TYPE_GUIDE}">
										<c:forEach items="${detail.resList}" var="res">
											<c:if test="${res.resType eq constant.RES_TYPE_GUIDE}">
											<c:if test="${res.resource.guideLan eq 0}">中文&nbsp;</c:if>
											<c:if test="${res.resource.guideLan eq 1}">中文&nbsp;</c:if>
											<c:if test="${res.resource.guideLan eq 2}">中文&nbsp;</c:if>
											</c:if>
										</c:forEach>
										</td>
										<c:choose>
										<c:when test="${routeVo.groupType eq constant.GROUP_TYPE_SIX}">
											<td class="setrec" align="right">[<a href="javascript:void(0);" onclick="setRes('${detail.routeDetail.cityId}',${constant.RES_TYPE_GUIDE},'添加导游','${detail.routeDetail.detailId}');">添加</a>]</td>
										</c:when>
										<c:when test="${routeVo.groupType eq constant.GROUP_TYPE_SEVEN}">
											<td class="setrec" align="right">[<a href="javascript:void(0);" onclick="setRes('${detail.routeDetail.cityId}',${constant.RES_TYPE_GUIDE},'定制导游','${detail.routeDetail.detailId}');">定制</a>]</td>
										</c:when>
										</c:choose>
									</tr>
									<tr class="rowalt2">
										<td>购物：</td>
										<td id="${detail.routeDetail.detailId}-${constant.RES_TYPE_SHOPPING}">
										<c:forEach items="${detail.resList}" var="res">
											<c:if test="${res.resType eq constant.RES_TYPE_SHOPPING}">
											${res.resource.spAddr}&nbsp;
											</c:if>
										</c:forEach>
										</td>
										<td class="setrec" align="right">[<a href="javascript:void(0);" onclick="setRes('${detail.routeDetail.cityId}',${constant.RES_TYPE_SHOPPING},'添加购物','${detail.routeDetail.detailId}');">添加</a>]</td>
									</tr>
									<tr>
										<td >其他：</td>
										<td id="${detail.routeDetail.detailId}-${constant.RES_TYPE_OTHER}">
										<c:forEach items="${detail.resList}" var="res">
											<c:if test="${res.resType eq constant.RES_TYPE_OTHER}">
											${res.resource.otherName}&nbsp;
											</c:if>
										</c:forEach>
										</td>
										<td class="setrec" align="right">[<a href="javascript:void(0);" onclick="setRes('${detail.routeDetail.cityId}',${constant.RES_TYPE_OTHER},'添加其他','${detail.routeDetail.detailId}');">添加</a>]</td>
									</tr>
									<tr class="rowalt2">
										<td>&nbsp;</td>
										<td>&nbsp;</td>
										<td class="setrec" align="right">[<a href="javascript:void(0);" onclick="">添加留宿</a>]</td>
									</tr>
								</table>
							</div>
							</c:forEach>
						</div>
					</div>
				</div>	<!-- end route -->
				<form id="orderForm" method="post" action="${ctx}/book/book.usr">
				<div style="margin: 5px;">
					<h2 style="background-image: url('${ctx}/img/front/users.png')">订单信息</h2>
					<div>
						<table cellspacing="0">
							<tr>
								<td class="titletd">行程：</td>
								<td width="280px">${route.day }天${route.night }夜    ${route.routeName}</td>
								<td class="titletd">出发地：</td>
								<td>${route.orgCityCn}</td>
							</tr>
							<tr>
								<td class="titletd">启程日期：</td>
								<td><input type="text" required="true" name="goTime" id="goTime" value="${order.goTime }" onfocus="WdatePicker({minDate:'%y-%M-%d'})"/></td>
								<td class="titletd">返回日期：</td>
								<td><input type="text" required="true" name="backTime" id="backTime" value="${order.backTime }"  onfocus="WdatePicker({minDate:'#F{$dp.$D(\'goTime\',{d:${route.day-1 }});}'})"/></td>
							</tr>
							<tr>
								<td class="titletd">双人间：</td>
								<td><input type="text"  name="doubleRoomCount" id="doubleRoom" value="${order.doubleRoomCount }" class="easyui-numberbox" min="0" max="38" precision="0" required="true"/>人</td>
								<td class="titletd">单人间：</td>
								<td><input type="text"  name="singleRoomCount" id="singleRoom" value="${order.singleRoomCount }" class="easyui-numberbox" min="0" max="38" precision="0" required="true"/>人</td>
							</tr>
							<tr>
								<td class="titletd">儿童占床：</td>
								<td><input type="text"  name="childBedCount" id="childHaveBed" value="${order.childBedCount }" class="easyui-numberbox" min="0" max="38" precision="0" required="true"/>人</td>
								<td class="titletd">儿童不占床：</td>
								<td><input type="text"  name="childNoBedCount" id="childNoBed" value="${order.childNoBedCount }" class="easyui-numberbox" min="0" max="38" precision="0" required="true"/>人</td>
							</tr>
							<tr>
								<td class="titletd">加床：</td>
								<td><input type="text"  name="addBedCount" id="addBed" value="${order.addBedCount }" class="easyui-numberbox" min="0" max="38" precision="0" required="true"/>人</td>
								<td class="titletd">总人数：</td>
								<td><input type="text" readonly="readonly" name="totalCount" id="totalNum" value="${order.totalCount }" style="background-color: #ccc;"/>人</td>
							</tr>
							<tr>
								<td class="titletd">备注：</td>
								<td ><textarea name="remark" style="width: 250px;height: 100px;border: 1px solid #92B7D0;">${order.remark }</textarea></td>
							<td class="titletd">总价：</td>
								<td><input type="text" value="${order.orderTotalAmount}" name="total" id="total" class="easyui-numberbox" min="0" max="38" precision="0" required="true"/>元</td>
							</tr>
						</table>
					</div>
				</div>		
				
				</form>
				<div style="text-align: center;margin-top: 10px;">
					
					<a style="text-decoration: none;" onclick="" class="easyui-linkbutton" iconCls="icon-print">打印</a>
				</div>
			</div><!-- end right -->
			<div class="vertical-border" style="height: 900px;"></div><!-- center border-line -->
		</div><!-- end content -->
	</div><!-- end main -->
	<div id="settingWin" modal="true" shadow="false" minimizable="false" cache="false" maximizable="false" collapsible="false" resizable="true" style="margin: 0px;padding: 0px;overflow: auto;"></div>
</body>

</html>
